package Listeners;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import GUI.AuthorToolPanel;
import GUI.ConferenceWizardFrame;
import Model.Conference;
import Model.Paper;
import Model.User;

/**
 * A listener that sets the decision for a paper.
 * 
 * @author InnoIrving V. Estrera
 * */
@SuppressWarnings("serial")
public class DecisionListener extends AbstractAction
{
  private int my_status = 0;
  private Paper my_paper;

  public DecisionListener(final int the_decision, final Paper the_paper)
  {
    my_status = the_decision;
    my_paper = the_paper;
  }

  @Override
  public void actionPerformed(ActionEvent arg0)
  {
    switch (my_status)
    {
    case -1:
      my_paper.editDecision(Conference.REJECTED);
      break;
    case 1:
      my_paper.editDecision(Conference.ACCEPTED);
      break;
    case 0:
      my_paper.editDecision(Conference.UNDECIDED);
      break;
    default:
      throw new IllegalArgumentException("Cannot set decision to " + my_status);
    }
  }

}
